<template>
	<view class="center">
		<u-cell-group>
			<u-cell-item icon="setting-fill" title="当前版本" :arrow="false"  :value="'v'+version"></u-cell-item>
			<u-cell-item title="修改登录密码" @click="goSetPass">
				<text class="u-font-30 " slot="icon"><text class=" fa fa-lock u-p-l-5 u-p-r-20"></text></text>
			</u-cell-item>
			<u-cell-item title="退出登录" value=""  @click="signOut">
				<text class="u-font-30 " slot="icon"><text class=" fa fa-sign-out u-p-l-5 u-p-r-10"></text></text>
			</u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo:[],
				login:false,
				version:'1.0.0'
			}
		},
		components:{
			Child:{
				template:"#child",
				data(){
					return{
						msg:"这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容这是内容"
					}
					
				}
			}
		},
		onLoad:function(){
		},
		onShow() {
			var _this = this;
			plus.runtime.getProperty(plus.runtime.appid, function(inf) {
				_this.version = inf.version
			});
		},
		methods: {
			goSetPass(){
				uni.navigateTo({
					url:"/pages/form/set_password"
					
				})
			},
			signOut(){
				try {
					uni.showToast({
						title: '退出成功'
					});
					uni.removeStorage({
					    key: 'userinfo',
					    success: function (res) {
					        console.log('success');
					    }
					});
					uni.removeStorage({
					    key: 'token',
					    success: function (res) {
							setTimeout(function () {
								uni.switchTab({
									url:"/pages/home/index"
								})
							}, 2000);
					    }
					});
					//uni.clearStorageSync();
					//const xvalue = uni.getStorageSync('userinfo');
				} catch (e) {
					// error
				}
				
			},
			clearStorage:function (){
				let that = this;
				uni.showModal({
					title:'提示',
					content:'确定清除缓存吗?',
					confirmText:'立即清除',
					success(res) {
						if(res.confirm){
							uni.clearStorageSync();
							//重新获取并显示清除后的缓存大小
							// that.getStorageSize();
							uni.showToast({
								title:'清除成功'
							})
						}
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}
	.center-list-item{
		border-top:1upx solid #eeeeee;
	}
</style>
